package com.ss.android.download;

import android.content.Context;
import android.os.AsyncTask;
import android.text.TextUtils;

public class h {
    public static final class a {
        public final g a;

        a(com.ss.android.download.g arg1) {
            this.a = arg1;
        }
    }

    public static final class b {
        public final String a;

        b(String arg1) {
            this.a = arg1;
        }
    }

    private static AsyncTask a;
    private static AsyncTask b;

    static {
        h.a = null;
        h.b = null;
    }

    public h() {

    }

    public static void a(Context arg3, a arg4) {
        String v0 = android.support.design.a.q();
        if (!TextUtils.isEmpty(((CharSequence) v0))) {
            if (h.b != null && h.b.getStatus() != AsyncTask.Status.FINISHED) {
                h.b.cancel(true);
            }

            try {
                j v1 = new com.ss.android.download.j(arg3, v0, arg4);
                h.b = ((AsyncTask) v1);
                com.bytedance.common.utility.b.a.a(((AsyncTask) v1), new Void[0]);
            } catch (Throwable v0_1) {
            }
        }
    }

    public static void a(Context arg3, b arg4) {
        String v0 = android.support.design.a.q();
        if (!TextUtils.isEmpty(((CharSequence) v0))) {
            if (h.a != null && h.a.getStatus() != AsyncTask.Status.FINISHED) {
                h.a.cancel(true);
            }

            Context v1 = arg3.getApplicationContext();
            try {
                i v2 = new i(v1, v0, arg4);
                h.a = ((AsyncTask) v2);
                com.bytedance.common.utility.b.a.a(((AsyncTask) v2), new Void[0]);
            } catch (Throwable v0_1) {
            }
        }
    }
}

